package action;

import java.util.List;

import service.ICommentService;
import service.IInfoService;
import service.IUserService;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

import domain.Information;

public class InformationAction extends ActionSupport {

	private IInfoService infoService;
	private IUserService userService;
	private ICommentService commentService;
	private String inforId;
	private String userName;
	private String title;
	private String content;
	private String type;
	private String userId;
	private Information information;
	private List<Information> informations;
	private String listTitle;
	public String execute() throws Exception {
		return SUCCESS;
	}
	
	public String list() throws Exception {
		listTitle = new String(listTitle.getBytes("ISO-8895-1"), "UTF-8");
		informations = infoService.getAllInfo();
		userId = (String) ActionContext.getContext().getSession().get("userId");
		userName = userService.getUserByID(userId).getUserName();
		return "list";
	}
	
	public IInfoService getInfoService() {
		return infoService;
	}
	public void setInfoService(IInfoService infoService) {
		this.infoService = infoService;
	}
	public IUserService getUserService() {
		return userService;
	}
	public void setUserService(IUserService userService) {
		this.userService = userService;
	}
	public ICommentService getCommentService() {
		return commentService;
	}
	public void setCommentService(ICommentService commentService) {
		this.commentService = commentService;
	}
	public String getInforId() {
		return inforId;
	}
	public void setInforId(String inforId) {
		this.inforId = inforId;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	public Information getInformation() {
		return information;
	}
	public void setInformation(Information information) {
		this.information = information;
	}
	public List<Information> getInformations() {
		return informations;
	}
	public void setInformations(List<Information> informations) {
		this.informations = informations;
	}

	public void setListTitle(String listTitle) {
		this.listTitle = listTitle;
	}

	public String getListTitle() {
		return listTitle;
	}
	
	
}
